<template>
	<div>
		<el-dialog title="添加商品" v-model="dialogVisible" class="redius8" width="1200" center :before-close="handleClose">
			<div class="relative">
				<el-tabs v-model="activeName" class="demo-tabs" @tab-click="handleClick">
					<el-tab-pane label="商品" name="message1">
						<tab1 @getValue="getValue" :idArr="idArr"></tab1>
					</el-tab-pane>
					<!-- <el-tab-pane label="套餐" name="message2">
						<tab2></tab2>
					</el-tab-pane> -->
					<!-- <el-tab-pane label="解决方案" name="message3">
						<tab3></tab3>
					</el-tab-pane> -->
				</el-tabs>
				<div class="absolute" style="right: 0;top: 15px;">
					<el-button type="defaultBtn" @click="handleAdd">确认添加</el-button>
				</div>
			</div>
		</el-dialog>	
	</div>
</template>

<script>
	import tab1 from "./components/tab1.vue"
	export default{
		components:{
			tab1
		},
		props:{
			idArr:{
				type:Array,
				default:res=>{
					return []
				}
			}
		},
		data(){
			return{
				dialogVisible:false,
				activeName:'message1',
				goodsId:[],
				selectGoods:[]
			}
		},
		methods:{
			open(){
				this.dialogVisible = true
				this.selectGoods = []
			},
			handleClose(){
				this.dialogVisible = false
			},
			getValue(e){
				this.selectGoods = e.join(',')
			},
			handleAdd(){
				if(this.selectGoods.length == 0){
					this.$modal.msgError('请选择商品')
					return false;
				}
				this.$emit('getGoods',this.selectGoods.split(','))
				this.handleClose()
			}
		}
	}
</script>

<style>
</style>